package com.demo.app.testvolley;

import android.util.Log;

import com.android.volley.Request;

import java.util.concurrent.BlockingQueue;

/**
 * 类描述
 *
 * @author <a href="mailto:903714484@qq.com">zhuting</a> on  2020/3/18$ 15:17$
 * @version 1.0
 * Copyright © 2019, www.yetancaijing.com All Rights Reserved.
 * 上海檀香文化咨询有限公司版权所有.
 */
public class MyThread extends Thread {

    private static final String TAG = MyThread.class.getSimpleName();
    private final BlockingQueue<String> mQueue;

    public MyThread(BlockingQueue<String> mQueue) {
        this.mQueue = mQueue;
    }

    @Override
    public void run() {
        super.run();

        while (true){

            try {
                Log.e(TAG, "run: 启动线程处理请求"+Thread.currentThread().getName());
                processRequest();
                Log.e(TAG, "run: "+Thread.currentThread().getName());
            } catch (InterruptedException e) {
                Log.e(TAG, "run: ",e);
            }

        }

    }

    private void processRequest() throws InterruptedException {
        // Take a request from the queue.
        String val = mQueue.take();
        Log.e(TAG, "processRequest: "+val);
    }
}
